//package com.jeeww.web.activiti.controller.base;
//
//import java.io.InputStream;
//import java.util.Locale;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.apache.log4j.Logger;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import com.jeeww.activiti.service.ActivitiCoreService;
//import com.jeeww.web.BaseController;
//
//
///**
// * 功能描述：activiti工作流核心扩展.
// */
//@Controller
//@RequestMapping("/activiti")
//public class ActivitiBaseController extends BaseController {
//    /**
//     * logger.
//     */
//    private Logger logger = Logger.getLogger(ActivitiBaseController.class);
//    /**
//     * 图片大小.
//     */
//    public static final int C_M_SIZE = 1024;
//    /**
//     * activitiCoreService.
//     */
//    @Autowired
//    private ActivitiCoreService activitiCoreService;
//
//    /**
//     * 功能描述：通过流程实例ID获得流程图.
//     * @param locale locale.
//     * @param req req.
//     * @param res res.
//     * @throws Exception e.
//     */
//    @RequestMapping(
//            value = "/getPDiagramBypdid.do", method = RequestMethod.GET)
//    public void getPDiagramBypdid(final Locale locale, final HttpServletRequest req, final HttpServletResponse res)
//            throws Exception {
//        if (logger.isDebugEnabled()) {
//            logger.info("通过流程实例ID获得流程图.");
//        }
//        String pdid = req.getParameter("pdid");
//        // 输出资源内容到相应对象
//        InputStream imageStream = activitiCoreService.getProcessDiagramByPdid(pdid);
//        if (imageStream != null) {
//            byte[] b = new byte[C_M_SIZE];
//            int len;
//            while ((len = imageStream.read(b, 0, C_M_SIZE)) != -1) {
//                res.getOutputStream().write(b, 0, len);
//            }
//        }
//    }
//    /**
//     * 功能描述：通过流程实例ID获得流程图.
//     * @param locale locale.
//     * @param req req.
//     * @param res res.
//     * @throws Exception e.
//     */
//    @RequestMapping(
//            value = "/getPDiagramBypiid.do", method = RequestMethod.GET)
//    public void getPDiagramBypiid(final Locale locale, final HttpServletRequest req, final HttpServletResponse res)
//            throws Exception {
//        if (logger.isDebugEnabled()) {
//            logger.info("通过流程实例ID获得流程图.");
//        }
//        String piid = req.getParameter("piid");
//        // 输出资源内容到相应对象
//        InputStream imageStream = activitiCoreService.getActivieDiagramByPiid(piid);
//        if (imageStream != null) {
//            byte[] b = new byte[C_M_SIZE];
//            int len;
//            while ((len = imageStream.read(b, 0, C_M_SIZE)) != -1) {
//                res.getOutputStream().write(b, 0, len);
//            }
//        }
//    }
//    /**
//     * 功能描述 :根据流程实例ID获得正在进行的节点的坐标信息等.
//     * @param req req.
//     * @return String 返回节点坐标信息.
//     * @throws Exception e.
//     */
//    @RequestMapping(
//            value = "/getActiveTasksPoint.do", method = RequestMethod.POST)
//    @ResponseBody
//    public String getActiveTasksPoint(final HttpServletRequest req) throws Exception {
//        if (logger.isDebugEnabled()) {
//            logger.debug("根据流程实例ID获得正在进行的节点的坐标信息等.");
//        }
//        String processInstanceId = req.getParameter("piid");
//        return activitiCoreService.getActiviePoint(processInstanceId);
//    }
//
//    /**
//     * 功能描述 :获得人员的任务信息.
//     * @param req req.
//     * @return String 返回任务信息.
//     * @throws Exception e.
//     */
//    @RequestMapping(
//            value = "/getActiveTasksByUid.do", method = RequestMethod.POST)
//    @ResponseBody
//    public String getActiveTasksByUid(final HttpServletRequest req) throws Exception {
//        if (logger.isDebugEnabled()) {
//            logger.debug("获得活动的任务信息.");
//        }
//        String assignee = "kermit";
//        return activitiCoreService.getActiveTasksByUid(assignee);
//    }
//}
